<template>
  <ul>
    <li>news001 <input type="text" /></li>
    <li>news002 <input type="text" /></li>
    <li>news003 <input type="text" /></li>
  </ul>
</template>

<script>
export default {
  name: "News",
  activated() {
    //需要keep-alive缓存并展示到页面中时触发，使用了keep-alive之后才会新增这两个生命周期！注意：activated()和deactivated()只有在<keep-alive></keep-alive>包裹的时候才有效；
    console.log("News被激活了");
  },
  deactivated() {
    //需要keep-alive缓存并没有展示到页面中时触发
    console.log("News失活了");
  },
};
</script>

<style>
</style>